<?php

class Obra extends AppModel {

    var $name = 'Obra';
    var $displayField = 'id';
    var $validate = array(
        'id' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'codigo_identificacion' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'isUnique' => array(
                'rule' => array('isUnique'),
                'message' => 'Este código de identificación ya ha sido asignado.',
            ),
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'nombre' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'isUnique' => array(
                'rule' => array('isUnique'),
                'message' => 'Este nombre ya ha sido asignado.',
            ),
            'custom' => array(
                'rule' => array('custom', '/^[a-záéíóúñüA-ZÁÉÍÓÚÑÜ0-9º\-\_\'\.\s]{3,}$/i'),
                'message' => 'El nombre de la obra debe ser alfanumérico.',
            ),
            'maxlength' => array(
                'rule' => array('maxlength', 100),
                'message' => 'La longitud máxima del nombre de la obra es 100 caracteres.',
            ),
        ),
        'ruta_tramo' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'custom' => array(
                'rule' => array('custom', '/^[a-záéíóúñüA-ZÁÉÍÓÚÑÜ0-9º\-\_\'\.\s]{3,}$/i'),
                'message' => 'El tramo de la ruta debe ser alfanumérico.',
            ),
            'maxlength' => array(
                'rule' => array('maxlength', 100),
                'message' => 'La longitud máxima del tramo de la ruta es 100 caracteres.',
            ),
        ),
        'progresiva' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'custom' => array(
                'rule' => array('custom', '/^[a-záéíóúñüA-ZÁÉÍÓÚÑÜ0-9º\-\_\.\+\s]{3,}$/i'),
                'message' => 'La progresiva debe ser alfanumérica.',
            ),
            'maxlength' => array(
                'rule' => array('maxlength', 50),
                'message' => 'La longitud máxima de la progresiva es 50 caracteres.',
            ),
        ),
        'ancho_calzada' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'carriles' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'tmda' => array(
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'sobrecarga_admisible' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'custom' => array(
                'rule' => array('custom', '/^[a-záéíóúñüA-ZÁÉÍÓÚÑÜ0-9º\-\_\.\s]{1,}$/i'),
                'message' => 'La sobrecarga admisible debe ser alfanumérica.',
            ),
            'maxlength' => array(
                'rule' => array('maxlength', 30),
                'message' => 'La longitud máxima de la sobrecarga admisible es 30 caracteres.',
            ),
        ),
        'fecha_alta' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
        ),
        'fecha_actualizacion' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
        ),
        'fecha_baja' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
        ),
        'obras_tipo_id' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'localidade_id' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'zona_id' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'ruta_id' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'obstaculo_id' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'materiales_tipo_id' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'datos_construccione_id' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'clases_transito_id' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'tipos_estructurale_id' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
            ),
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'nivele_id' => array(
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'habilitada' => array(
            'numeric' => array(
                'rule' => array('numeric'),
                'message' => 'Campo inválido',
            ),
        ),
        'clase_posicion' => array(
            'inlist' => array(
                'rule' => array('inlist', array('', 'Lateral', 'Transversal')),
                'message' => 'Campo inválido',
            ),
        ),
        'obra_geom' => array(
            'notempty' => array(
                'rule' => array('notempty'),
                'message' => 'Campo requerido',
                'on' => 'update',
            ),
        ),
    );
    //The Associations below have been created with all possible keys, those that are not needed can be removed
    var $belongsTo = array(
        'ObrasTipo' => array(
            'className' => 'ObrasTipo',
            'foreignKey' => 'obras_tipo_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'Localidade' => array(
            'className' => 'Localidade',
            'foreignKey' => 'localidade_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'Zona' => array(
            'className' => 'Zona',
            'foreignKey' => 'zona_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'Ruta' => array(
            'className' => 'Ruta',
            'foreignKey' => 'ruta_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'Obstaculo' => array(
            'className' => 'Obstaculo',
            'foreignKey' => 'obstaculo_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'Nivele' => array(
            'className' => 'Nivele',
            'foreignKey' => 'nivele_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'MaterialesTipo' => array(
            'className' => 'MaterialesTipo',
            'foreignKey' => 'materiales_tipo_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'DatosConstruccione' => array(
            'className' => 'DatosConstruccione',
            'foreignKey' => 'datos_construccione_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'ClasesTransito' => array(
            'className' => 'ClasesTransito',
            'foreignKey' => 'clases_transito_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'TiposEstructurale' => array(
            'className' => 'TiposEstructurale',
            'foreignKey' => 'tipos_estructurale_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        )
    );
    var $hasMany = array(
        'Pliego' => array(
            'className' => 'Pliego',
            'foreignKey' => 'obra_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        ),
        'Tramo' => array(
            'className' => 'Tramo',
            'foreignKey' => 'obra_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        ),
        'Foto' => array(
            'className' => 'Foto',
            'foreignKey' => 'obra_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        ),
        'Plano' => array(
            'className' => 'Plano',
            'foreignKey' => 'obra_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        ),
        'ElementosSuperestructura' => array(
            'className' => 'ElementosSuperestructura',
            'foreignKey' => 'obra_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        ),
        'Evaluacione' => array(
            'className' => 'Evaluacione',
            'foreignKey' => 'obra_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        ),
        'ElementosInfraestructura' => array(
            'className' => 'ElementosInfraestructura',
            'foreignKey' => 'obra_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        ),
        'Intervencione' => array(
            'className' => 'Intervencione',
            'foreignKey' => 'obra_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        ),
        'ElementosSenializacione' => array(
            'className' => 'ElementosSenializacione',
            'foreignKey' => 'obra_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        )
    );

}
?>